From: Keir Fraser Date: Mon, 22 Feb 2010 10:07:27 +0000 (+0000) Subject: Fix blktap2 test in xen-hotplug-cleanup X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12579 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=a64e08899bd2768aaebe0bbf2c42fe0d838d4a7a;p=xen.git Fix blktap2 test in xen-hotplug-cleanup The blktap2 test in xen-hotplug-cleanup was not quite right, causing orphaned /vm//device node in xenstore. Attempt to reattach the device failed: xen53: # xm block-attach 0 file:/tmp/d0 /dev/xvdp r xen53: # xm block-detach 0 /dev/xvdp xen53: # xenstore-ls /vm/00000000-0000-0000-0000-000000000000/device vbd =3D "" 51952 =3D "" frontend =3D "/local/domain/0/device/vbd/51952" frontend-id =3D "0" backend-id =3D "0" backend =3D "/local/domain/0/backend/vbd/0/51952" xen53: # xm block-attach 0 file:/tmp/d0 /dev/xvdp r Error: Device /dev/xvdp (51952, vbd) is already connected. Usage: xm block-attach [BackDomain] From: Jim Fehlig Signed-off-by: Keir Fraser --- diff --git a/tools/hotplug/Linux/xen-hotplug-cleanup b/tools/hotplug/Linux/xen-hotplug-cleanup index f4d016232d..adaa9d6a23 100644 --- a/tools/hotplug/Linux/xen-hotplug-cleanup +++ b/tools/hotplug/Linux/xen-hotplug-cleanup @@ -21,7 +21,7 @@ if [ "$vm" != "" ]; then # if the vm path does not exist and the device class is 'vbd' then we may have # a tap2 device - if [ ! $(xenstore-read "vm_dev" 2>/dev/null) ] \ + if [ $(xenstore-read "$vm_dev" 2>/dev/null) != "" ] \ && [ "${path_array[1]}" = "vbd" ]; then vm_dev="$vm/device/tap2/${path_array[3]}" fi